package com.rslai.base.tool.servertest.config;

import com.rslai.base.tool.servertest.annotation.Property;
import com.rslai.base.tool.servertest.command.PreDataStepCommand;
import com.rslai.base.tool.servertest.command.StepCommand;
import com.rslai.base.tool.servertest.model.KeyValueStore;

import java.util.Arrays;

public class PreDataStepConfig extends StepConfig {
    public static final String FILE = "file";
    public static final String DATABASE = "database";
    public static final String REPLACETABLENAME = "replaceTableName";
    public static final String CACHED = "cached";

    @Property(value = "file", required = true)
    String file;

    @Property(defaultValue = "default")
    String database;

    @Property("replaceTableName")
    String replaceTableName;

    @Property("cached")
    String cached;

    public StepCommand createCommand() {
        return new PreDataStepCommand(Arrays.asList(new KeyValueStore[]{new KeyValueStore("file", this.file), new KeyValueStore("database", this.database), new KeyValueStore("replaceTableName", this.replaceTableName), new KeyValueStore("cached", this.cached)}));
    }
}
